package controller.UserTable;

import entity.MsgResult;
import entity.user;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import service.SelectAllUserService;
import java.util.*;

@Controller
public class SelectAllUserController {
    @Autowired
    private SelectAllUserService selectAllUserService;

    @RequestMapping("/selectAllUser")
    @ResponseBody
    public MsgResult selectAllUser(Model model){
        MsgResult msgResult = new MsgResult();
        List<user> users = selectAllUserService.selectAllUser();
        HashMap<String, Object> map = new HashMap<>();
        map.put("users",users);
        msgResult.setData(map);
        msgResult.setFlag(1);
        msgResult.setMsg("查询全部成功");
        return msgResult;
    }
}
